# path 为文件路径，n 为每行要删除的前几个字符数
def delete(path, n):
    new_str = ""
    f = open(path, 'r+', encoding='UTF-8')
    d = f.readlines()
    for i in d:
        for j in range(0, len(i)):
            if j > n-1:
                new_str = new_str+i[j]
    f.write('\n')
    f.write(new_str)  # 在该文件最后追加写入新的字符串
    f.close()
if __name__ == '__main__':
    delete("C:\\Users\\Javid\\Desktop\\1.txt", 4) # 删除每行前4个字符，保留其他